﻿
@{ ViewBag.Title = "修改密码"; }
<div class="layui-col-xs12 layui-col-sm6 layui-col-md6">
    <div class="layui-input-block layui-red pwdTips"></div>
    <div class="layui-form-item">
        <label class="layui-form-label">原密码</label>
        <div class="layui-input-block">
            <input type="password" name="Original" placeholder="请输入原密码" lay-verify="required" class="layui-input pwd layui-form-danger">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">新密码</label>
        <div class="layui-input-block">
            <input type="password" name="Password" placeholder="请输入新密码" lay-verify="required" class="layui-input pwd">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">确认密码</label>
        <div class="layui-input-block">
            <input type="password" name="RePassword" placeholder="请确认密码" lay-verify="required" class="layui-input pwd">
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit lay-filter="save">立即修改</button>
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
        </div>
    </div>
</div>
@section script{
    <script type="text/javascript">
        layui.use(['form', 'tools'], function () {
            var $ = layui.$,
                form = layui.form, tools = layui.tools;
            form.on("submit(save)", function (data) {
                //if (data.field.Password.length < 6 || data.field.RePassword.length < 6) {
                //    tools.msg("密码长度不能少于6个字符");
                //    return false;
                //}
                //if (data.field.Password !== data.field.RePassword) {
                //    tools.msg("确认密码与新密码不一致");
                //    return false;
                //}
                tools.submit({
                    url: '/Main/Home/ChangePwd',
                    data: data.field,
                    loading: "正在保存数据...",
                    success: function () {
                        $("button[type='reset']").click();
                    }
                });
                return false;
            });
        });
    </script>
}